package com.scoy.honeymei.activity.mall;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import com.google.android.material.tabs.TabLayout;
import com.scoy.honeymei.R;
import com.scoy.honeymei.adapter.CouponListAdapter;
import com.scoy.honeymei.adapter.tabadapter.TabFragmentIntAdapter;
import com.scoy.honeymei.base.BaseActivity;
import com.scoy.honeymei.fragment.mall.TravelMeFragment;
import com.scoy.honeymei.fragment.mall.TripMeFragment;
import com.scoy.honeymei.utils.MyUtil;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * @ClassName: TravelMeActivity$
 * @Description: 我的订单出行界面
 * @Author: GaoZhan
 * @CreateDate: 2019/9/9/0009$ 下午 14:17$
 * @UpdateUser: 更新者
 * @UpdateDate: 2019/9/9/0009$ 下午 14:17$
 * @UpdateRemark: 更新内容
 */
public class TripMeActivity extends BaseActivity {

    @BindView(R.id.back_iv)
    ImageView backIv;
    @BindView(R.id.title_tv)
    TextView titleTv;
    @BindView(R.id.sign_tv)
    TextView signTv;
    @BindView(R.id.title_llt)
    LinearLayout titleLlt;
    @BindView(R.id.mt_tab)
    TabLayout mtTab;
    @BindView(R.id.mt_vp)
    ViewPager mtVp;
    private TripMeActivity mContext;
    private ArrayList<String> datalist;
    private CouponListAdapter couponListAdapter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_me_travel);
        ButterKnife.bind(this);
        mContext = TripMeActivity.this;


        initNormal();

        initTab();
    }

    @Override
    public void initNormal() {
        titleTv.setText("出行");

        MyUtil.setStatusBar(mContext, getWindow(), true, R.color.colorWhite);
        titleLlt.setPadding(0, MyUtil.getStatusBarHeight(mContext), 0, 0);

    }

    private void initTab() {
        int[] mTitles = new int[]{R.string.previewtrip, R.string.ended};
        ArrayList<Fragment> fragments = new ArrayList<>();
        for (int i = 0; i < mTitles.length; i++) {
            fragments.add(TripMeFragment.newInstance(i));
        }

        TabFragmentIntAdapter tabFragmentAdapter = new TabFragmentIntAdapter(mContext, getSupportFragmentManager(), fragments, mTitles);
        mtTab.setupWithViewPager(mtVp, false);
        mtVp.setAdapter(tabFragmentAdapter);
        mtVp.setCurrentItem(0);
    }

    @OnClick({R.id.back_iv, R.id.title_tv})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.back_iv:
                finish();
                break;
            case R.id.title_tv:
                break;
        }
    }


}
